package com.minimalist.common.entity.lindi.vo.tradeapplicationfile;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 林地指标交易平台_交易申请相关文件 VO类。
 *
 * @author 11987
 * @since 2025-04-27
 */
@Schema(description = "林地指标交易平台_交易申请相关文件")
public class LindiTradeApplicationFileVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    // ========== 基本信息 ==========

    @NotNull(message = "交易申请相关文件ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "交易申请相关文件ID")
    private Long tradeApplicationFileId;

    @NotNull(message = "交易申请ID不能为空", groups = {Add.class, Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "交易申请ID")
    private Long tradeApplicationId;

    @NotNull(message = "文件类型不能为空", groups = {Add.class, Update.class})
    @Schema(description = "文件类型")
    private Integer fileType;

    @NotNull(message = "文件URL不能为空", groups = {Add.class, Update.class})
    @Schema(description = "文件URL")
    private String fileUrl;

    // ========== 文件详细信息 ==========

    @Schema(description = "文件名称")
    private String fileName;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "文件大小（字节）")
    private Long fileSize;

    @Schema(description = "文件类型描述")
    private String fileTypeDesc;

    // ========== 多租户字段 ==========

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "租户ID")
    private Long tenantId;

    // ========== 审计字段 ==========

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "创建人ID")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "更新人ID")
    private Long updateId;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    public Long getTradeApplicationFileId(){
        return tradeApplicationFileId;
    }

    public void setTradeApplicationFileId(Long tradeApplicationFileId){
        this.tradeApplicationFileId = tradeApplicationFileId;
    }

    public Long getTradeApplicationId(){
        return tradeApplicationId;
    }

    public void setTradeApplicationId(Long tradeApplicationId){
        this.tradeApplicationId = tradeApplicationId;
    }

    public Integer getFileType(){
        return fileType;
    }

    public void setFileType(Integer fileType){
        this.fileType = fileType;
    }

    public String getFileUrl(){
        return fileUrl;
    }

    public void setFileUrl(String fileUrl){
        this.fileUrl = fileUrl;
    }

    public String getFileName(){
        return fileName;
    }

    public void setFileName(String fileName){
        this.fileName = fileName;
    }

    public Long getFileSize(){
        return fileSize;
    }

    public void setFileSize(Long fileSize){
        this.fileSize = fileSize;
    }

    public String getFileTypeDesc(){
        return fileTypeDesc;
    }

    public void setFileTypeDesc(String fileTypeDesc){
        this.fileTypeDesc = fileTypeDesc;
    }

    public Long getTenantId(){
        return tenantId;
    }

    public void setTenantId(Long tenantId){
        this.tenantId = tenantId;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiTradeApplicationFileVO that = (LindiTradeApplicationFileVO) o;
        return Objects.equals(tradeApplicationFileId, that.tradeApplicationFileId)
                && Objects.equals(tradeApplicationId, that.tradeApplicationId)
                && Objects.equals(fileType, that.fileType)
                && Objects.equals(fileUrl, that.fileUrl)
                && Objects.equals(fileName, that.fileName)
                && Objects.equals(fileSize, that.fileSize)
                && Objects.equals(fileTypeDesc, that.fileTypeDesc)
                && Objects.equals(tenantId, that.tenantId)
                && Objects.equals(createId, that.createId)
                && Objects.equals(updateId, that.updateId)
                && Objects.equals(createTime, that.createTime)
                && Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(tradeApplicationFileId, tradeApplicationId, fileType, fileUrl, fileName, fileSize, fileTypeDesc, tenantId, createId, updateId, createTime, updateTime);
    }
}